#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1005;

int n, m;
vector<int> ch[N];
int st[N], top;
vector<int> ower;
int p[N];
void dfs(int u, int fu) {
  int t = top;
  for (int v : ch[u]) {
    if (v == fu) continue;
    dfs(v, u);
    if (top - t >= m) {
      ower.push_back(u);
      while (top > t) {
        p[st[top--]] = ower.size();
      }
    }
  }
  st[++top] = u;
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  rep(i, 2, n) {
    int u, v;
    cin >> u >> v;
    ch[u].push_back(v);
    ch[v].push_back(u);
  }
  dfs(1, 1);
  if (ower.empty()) ower.push_back(1);
  while (top) {
    p[st[top--]] = ower.size();
  }
  cout << ower.size() << endl;
  rep(i, 1, n) cout << p[i] << ' ';
  cout << endl;
  for (int x : ower) cout << x << ' ';
  return 0;
}